<template>
  <div>
    <div class="head jlayoutBetween">
      <div class="btnleft">
      </div>
      <div class="btnright">
        <a v-if="rightShowArray.indexOf('close') !== -1" class="abtn" @click="btnClicked('close')"><i class="aicon i6"></i>{{bpmcoreI18n.close}}</a>
        <a v-if="rightShowArray.indexOf('save') !== -1" class="abtn" @click="btnClicked('save')"><i class="aicon i3"></i>{{bpmcoreI18n.save}}</a>
      </div>
    </div>
  </div>
</template>

<script>
import {mapState} from 'vuex'

export default {
  name: 'bpmCSubnavbar',
  props: {
    title: '',
    rightShowArray: {
      type: Array,
      default () {
        return []
      }
    }
  },
  computed: {
    ...mapState(['lang', 'bpmcoreI18n'])
  },
  methods: {
    btnClicked (btnType) {
      console.log('nav header btn click -> back into nav:', btnType)
      if (btnType === 'save') {
        this.$emit('navClicked', btnType)
      } else if (btnType === 'close') {
        this.$emit('navClicked', btnType)
      }
    }
  }
}
</script>

<style scoped>
  .head {
    width: 100%;
    height: 39px;
    padding: 0 19px;
    box-sizing: border-box;
    background: url(/static/images/contentBg.png) repeat-x 0 0;
  }

  .head1 {
    background: url(/static/images/contentBg.png) repeat-x 0 -337px;
    color: #475d68;
    font-size: 14px;
    font-weight: bold;
    width: 980px;
    height: 26px;
    line-height: 26px;
  }

  .btn {
    background: url(/static/images/contentBg.png) no-repeat -116px -122px;
    height: 24px;
    width: 60px;
    display: block;
    color: #f0f0f0;
    text-align: center;
    line-height: 24px;
    float: left;
    margin-right: 5px;
    border: 0;
    cursor: pointer;
  }

  .aicon {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    float: left;
  }

  .abtn {
    color: #fff;
    display: block;
    padding: 5px;
    float: right;
    height: 14px;
    text-align: left;
    cursor: pointer;
  }

  .i3 {
    background: url(/static/images/contentBg.png) no-repeat 0 -44px;
  }

  .i6 {
    background: url(/static/images/contentBg.png) no-repeat 0 -217px;
  }
  .btnleft {
    float: left;
    width: 30%;
  }
  .btnright {
    float: right;
    width: 70%;
  }
</style>
